package br.usp.pcs.acs.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ScrollPanel;

public class CAHome extends Composite {
	
	private HorizontalPanel bottomHorizontalPanel;
	private FlightListPanel flightListPanel;
	private ResourceListPanel resourceListPanel;
	private EmployeeListPanel employeeListPanel;
	private AircraftsListPanel aircraftsListPanel;
	private HorizontalPanel searchHorizontalPanel;

	public CAHome() {
		{
			VerticalPanel verticalPanel = new VerticalPanel();
			initWidget(verticalPanel);
			verticalPanel.setSize("100%", "100%");
			{
				DecoratedTabPanel caDecoratedTabPanel = new DecoratedTabPanel();
				verticalPanel.add(caDecoratedTabPanel);
				caDecoratedTabPanel.setSize("100%", "100%");
				{
					VerticalPanel flightsVerticalPanel = new VerticalPanel();
					caDecoratedTabPanel.add(flightsVerticalPanel, "V\u00F4os", false);
					flightsVerticalPanel.setSize("100%", "100%");
					{
						searchHorizontalPanel = new HorizontalPanel();
						flightsVerticalPanel.add(searchHorizontalPanel);
						searchHorizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
						{
							addSearchFlightPanel();
						}
						bottomHorizontalPanel = new HorizontalPanel();
						flightsVerticalPanel.add(bottomHorizontalPanel);
						bottomHorizontalPanel.setSize("99.2%", "277px");
						{
							addFlightList();
						}
					}
				}
				{
					VerticalPanel resourcesVerticalPanel = new VerticalPanel();
					caDecoratedTabPanel.add(resourcesVerticalPanel, "Recursos", false);
					resourcesVerticalPanel.setSize("100%", "100%");
					{
						bottomHorizontalPanel = new HorizontalPanel();
						resourcesVerticalPanel.add(bottomHorizontalPanel);
						bottomHorizontalPanel.setSize("99.2%", "277px");
						{
							addResourcesList();
						}
					}
				}
				{
					VerticalPanel aircraftsVerticalPanel = new VerticalPanel();
					caDecoratedTabPanel.add(aircraftsVerticalPanel, "Aeronaves", false);
					aircraftsVerticalPanel.setSize("100%", "100%");
					{
						searchHorizontalPanel = new HorizontalPanel();
						aircraftsVerticalPanel.add(searchHorizontalPanel);
						searchHorizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
						{
							addSearchAircraftsPanel();
						}
						bottomHorizontalPanel = new HorizontalPanel();
						aircraftsVerticalPanel.add(bottomHorizontalPanel);
						bottomHorizontalPanel.setWidth("100%");
						{
							addAircraftsList();
						}
					}
				}
				{
					VerticalPanel employeesVerticalPanel = new VerticalPanel();
					caDecoratedTabPanel.add(employeesVerticalPanel, "Funcion\u00E1rios", false);
					employeesVerticalPanel.setSize("100%", "100%");
					{
						searchHorizontalPanel = new HorizontalPanel();
						employeesVerticalPanel.add(searchHorizontalPanel);
						searchHorizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
						{
							addSearchEmployeePanel();
						}
						bottomHorizontalPanel = new HorizontalPanel();
						employeesVerticalPanel.add(bottomHorizontalPanel);
						bottomHorizontalPanel.setSize("99.2%", "277px");
						{
							addEmployeeList();
						}
					}
				}
				caDecoratedTabPanel.selectTab(0);
			}
		}
	}
	
	public void addFlightList(){

    	flightListPanel = new FlightListPanel();
		bottomHorizontalPanel.add(flightListPanel);
		flightListPanel.setWidth("100%");
    }
	
	public void addResourcesList(){

    	resourceListPanel = new ResourceListPanel();
		bottomHorizontalPanel.add(resourceListPanel);
		resourceListPanel.setWidth("100%");
    }
	
	public void addAircraftsList(){

		aircraftsListPanel = new AircraftsListPanel();
		bottomHorizontalPanel.add(aircraftsListPanel);
		aircraftsListPanel.setWidth("100%");
    }
	
	public void addEmployeeList(){

		employeeListPanel = new EmployeeListPanel();
		bottomHorizontalPanel.add(employeeListPanel);
		employeeListPanel.setWidth("100%");
    }
	
	public void addSearchFlightPanel(){
		SearchPanel searchPanel = new SearchPanel();
		searchHorizontalPanel.add(searchPanel);
	}
	
	public void addSearchAircraftsPanel(){
		SearchAircraftsPanel searchPanel = new SearchAircraftsPanel();
		searchHorizontalPanel.add(searchPanel);
	}
	
	public void addSearchEmployeePanel(){
		SearchEmployeePanel searchPanel = new SearchEmployeePanel();
		searchHorizontalPanel.add(searchPanel);
	}
}
